package com.pro.common.service.user.model.db;

import com.pro.common.api.CommonConst;
import com.pro.common.api.model.BaseUserModel;
import com.pro.common.api.model.ILoginLog;
import com.pro.common.api.model.auth.IUserDataClass;
import com.pro.framework.javatodb.annotation.JTDTable;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.time.LocalDateTime;

@Data

@EqualsAndHashCode(callSuper = true)
@Schema(description = "用户登录日志")
@JTDTable(entityId = 127, module = CommonConst.Modules.user,
        sequences = {
                "UNIQUE KEY `uk_tokenMd5` (`token_md5`)",
                "KEY `idx_userId_loginStatus_loginEntrance` (`user_id`,`login_status`,`login_entrance`)",
        })
public class UserLoginLog extends BaseUserModel implements IUserDataClass, ILoginLog {
    //    @Schema(description = "用户ID")
//    @JTDField(notNull = JTDConst.EnumFieldNullType.can_null) // 设置为可空，为了创建模拟收货地址
//    private Long userId;
    @Schema(description = "token")
    private String tokenMd5;
    @Schema(description = "子账号Id")
    private Long subAccountId;
    @Schema(description = "登录状态")
    private Boolean loginStatus;
    @Schema(description = "过期时间")
    private LocalDateTime expireTime;
    @Schema(description = "上次活跃时间")
    private LocalDateTime lastActiveTime;
    @Schema(description = "登录端口")
    private String loginEntrance;
    @Schema(description = "登录ip")
    private String loginIp;


}
